package com.bgys.common.domain;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.util.List;

/**
 * 分页信息
 * @author 悲歌易水
 */
@Data
public class PageBean<T>{
    private List<T> list;
    private long pageCurrent;
    private long pageSize;
    private long total;

    public PageBean() {

    }

    public PageBean(List<T> list) {
        this.list = list;
        this.pageCurrent = 1;
        this.total = list.size();
    }

    public PageBean(List<T> list, long pageCurrent, long pageSize, long total) {
        this.list = list;
        this.pageCurrent = pageCurrent;
        this.pageSize = pageSize;
        this.total = total;
    }

    public PageBean(IPage<T> iPage) {
        this.list = iPage.getRecords();
        this.pageCurrent = iPage.getCurrent();
        this.pageSize = iPage.getSize();
        this.total = iPage.getTotal();
    }
}
